<template>
  <div class="managemenu">
    <el-button class="addbtn" type="primary" plain icon="el-icon-plus" size="mini" @click="addlink('add')">新增</el-button>
    <div class="table-box">
      <el-table id="outTable" ref="myTable" :data="menulist" style="width: 100%" border row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
        <el-table-column prop="title" label="菜单名称" />
        <el-table-column prop="path" label="菜单地址" />
        <el-table-column prop="mark" label="权限标识" />
        <el-table-column label="图标">
          <template #default="{row}">
            <svg-icon :icon-class="row.icon" />
          </template>
        </el-table-column>
        <el-table-column prop="component" label="组件路径" />
        <el-table-column label="类型">
          <template #default="{row}">
            <div class="type">{{ row.type===1?'菜单':'按钮' }}</div>
          </template>
        </el-table-column>
        <el-table-column label="是否显示">
          <template #default="{row}">
            <el-switch v-model="row.is_show" style="display: block" :active-value="1" :inactive-value="0" />
          </template>
        </el-table-column>
        <el-table-column prop="" label="操作">
          <template>
            <div style="display: flex; justify-content: center; align-items: center;">
              <el-button size="mini" circle type="primary" icon="el-icon-edit" />
              <el-button size="mini" circle type="warning" icon="el-icon-plus" />
              <el-button size="mini" type="danger" icon="el-icon-delete" circle />
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import { getmenu } from '@/api/power'
export default {
  data() {
    return {
      menulist: []
    }
  },
  created() {
    this.getmenulist()
  },
  methods: {
    async getmenulist() {
      const res = await getmenu()
      console.log(res)
      this.menulist = res
    }
  }

}
</script>
<style>
.managemenu {
  padding: 10px;
  margin: 10px;
}
.addbtn {
  margin-bottom: 10px;
}
.type {
  border: 1px solid #d9ecff;
  color: #409eff;
  background-color: #ecf5ff;
  text-align: center;
  border-radius: 5px;
  width: 60px;
  height: 30px;
  font-size: 12px;
  line-height: 30px;
  margin: auto;
}
</style>
